package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentCharge;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentChargeService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentChargeController") 
@RequestMapping("/cms/content/service/cmsContentCharge")
public class CmsContentChargeController extends BaseController {

	
	@Autowired
	private ICmsContentChargeService cmsContentChargeService;
	
	@RequiresPermissions(value="cmsContentCharge:loadCmsContentChargeDataSet",desc="内容付费列表")
    @RequestMapping(value="/loadCmsContentChargeDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentChargeDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentChargeService.loadCmsContentChargeDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentCharge:createCmsContentCharge",desc="内容付费添加")
    @RequestMapping(value="/createCmsContentCharge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentCharge(CmsContentCharge cmsContentCharge){
		cmsContentChargeService.createCmsContentCharge(cmsContentCharge);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentCharge:loadCmsContentCharge",desc="内容付费加载")
    @RequestMapping(value="/loadCmsContentCharge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentCharge(Long id){
		Optional<CmsContentCharge> ops = cmsContentChargeService.loadCmsContentChargeById(id);
		return ajaxQuery("cmsContentCharge",ops);
    }
	
	@RequiresPermissions(value="cmsContentCharge:updateCmsContentCharge",desc="内容付费更新")
    @RequestMapping(value="/updateCmsContentCharge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentCharge(CmsContentCharge cmsContentCharge){
		cmsContentChargeService.updateCmsContentCharge(cmsContentCharge);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentCharge:deletCmsContentCharge",desc="内容付费删除")
    @RequestMapping(value="/deleteCmsContentCharge", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentCharge(Long id){
		cmsContentChargeService.deleteCmsContentCharge(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}